package top.lyc829.aircontroller.ui.videoPlay;

import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;


import java.util.Objects;

import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;
import top.lyc829.aircontroller.R;
import top.lyc829.aircontroller.logic.utils.GlobalConfig;
import top.lyc829.aircontroller.ui.BaseActivity;

public class VideoPlayActivity extends BaseActivity {

    private JzvdStd videoPlay;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        Objects.requireNonNull(getSupportActionBar()).hide();

        setContentView(R.layout.activity_video_play);

        setFullscreen();

        Intent intent = getIntent();
        String name = intent.getStringExtra("name");
        String part = intent.getStringExtra("part");
        String url = GlobalConfig.VIDEO_ADDRESS + name + "/" + part + "/" + part + ".flv";

        videoPlay = findViewById(R.id.video_play);
        videoPlay.setUp(url,name, JzvdStd.SCREEN_FULLSCREEN);
    }

    @Override
    public void onBackPressed() {
        Jzvd.backPress();
        super.onBackPressed();
    }
    @Override
    protected void onPause() {
        super.onPause();
        Jzvd.releaseAllVideos();
    }


}